import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int count=0;
        int maxcount=0;
        while(n>0){
            if((n&1)==1){
                count++;
                maxcount=Math.max(count,maxcount);
            }else{
                count=0;
            }
            n>>=1;
        }
        System.out.println(maxcount);
    }
}
